package com.jialea.luobochat.server.config;

import com.jialea.luobochat.server.config.properties.MinIOProperties;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: wf
 * @created: 2024/6/22 22:06
 */
@Configuration
public class MinIOConfig {
    @Autowired
    private MinIOProperties minIOProperties;

    @Bean
    public MinioClient buildMinioClient() {
        return MinioClient
                .builder()
                .credentials(minIOProperties.getAccessKey(), minIOProperties.getSecretKey())
                .endpoint(minIOProperties.getUrl())
                .build();
    }
}
